package com.zshan.clinic.web.constant;

import com.zshan.clinic.common.util.string.StringUtil;

public class WebConstant {

    public static final String request_prefix = "/web";

    //过滤器白名单
    public static final String [] filter_allow = {request_prefix + "/login",request_prefix + "/file",request_prefix + "/clinic/info/getBoardClinicInfo",request_prefix + "/shanghe/upload"};

    //过滤器白名单
    public static final String [] interceptor_allow = {request_prefix + "/login",request_prefix + "/file",request_prefix + "/clinic/info/getBoardClinicInfo",request_prefix + "/shanghe/upload"};


    public static boolean isInterceptorAllow(String requestUri) {
        //1.定义一个标记
        boolean flag = false;
        //2.遍历允许访问的路径
        for (String path : WebConstant.interceptor_allow){
            if (StringUtil.isNotBlank(path) && requestUri.startsWith(path)){
                flag = true;
                break;
            }
        }
        return flag;
    }

    public static boolean isFilterAllow(String requestUri) {
        //1.定义一个标记
        boolean flag = false;
        //2.遍历允许访问的路径
        for (String path : WebConstant.filter_allow){
            if (StringUtil.isNotBlank(path) && requestUri.startsWith(path)){
                flag = true;
                break;
            }
        }
        return flag;
    }
}
